import { io } from './io'

export const queryMasterCardLit = (params: Api.Card.MasterCardSearchParams) =>
    io<Api.Card.MasterCardList>({
        url: '/api/v1/card/mastercard/list',
        method: 'GET',
        params
    })

export const queryMasterCardDetail = (uid: number) =>
    io<Api.Card.MasterCardDetail>({
        url: `/api/v1/card/mastercard/info/${uid}`,
        method: 'GET'
    })

export const updateMasterCardKyc = (uid: number, data: Api.Card.KycDetailParams) =>
    io<{ success: boolean }>({
        url: `/api/v1/card/mastercard/kyc/${uid}`,
        method: 'PUT',
        data
    })

export const updateMasterCardStatus = (
    uid: number,
    data: {
        status: Api.Card.MasterCardDetail['cardStatus']
        cardImage: string
        requestId: string
        refusalReason?: string
    }
) =>
    io<boolean>({
        url: `/api/v1/card/mastercard/authstatus/${uid}`,
        method: 'PUT',
        data
    })

export const queryTransferCardLit = (params: Api.Card.TransferCardSearchParams) =>
    io<Api.Card.TransferCardList>({
        url: '/api/v1/card/transfercard/list',
        method: 'GET',
        params
    })

export const queryTransferCardDetail = (uid: number) =>
    io<Api.Card.TransferCardDetail>({
        url: `/api/v1/card/transfercard/info/${uid}`,
        method: 'GET'
    })

export const updateTransferCardStatus = (id: number, status: Api.Card.TransferCardDetail['cardStatus']) =>
    io<boolean>({
        url: `/api/v1/card/transfercard/authstatus/${id}`,
        method: 'PUT',
        data: {
            status
        }
    })

export const queryCountryList = () =>
    io<{
        list: string[]
    }>({
        url: '/api/v1/card/country/list',
        method: 'GET'
    })
